package com.stxx.stiot2.domain;

import com.stxx.framwork.annotation.Id;
import com.stxx.framwork.constants.ChangeType;
import com.stxx.framwork.constants.FluxDataType;
import com.stxx.framwork.constants.StorePolicyType;
import com.stxx.stiot2.domain.ext.AlarmPlan;
import com.stxx.stiot2.domain.ext.AlarmSetting;
import lombok.Data;
import org.noear.snack.annotation.ONodeAttr;

import java.io.Serializable;
import java.util.List;

/**
 * @author Fuzhenlei
 * @date 2025/01/13 16:29
 */
@Data
public class Signal implements Serializable {
    @Id
    private String code;
    private String name;
    /**
     * bool
     * string
     * integer
     * long
     * float
     */
    private FluxDataType fieldType;
    /**
     * 默认值
     */
    private String defaultValue;
    /**
     * 分组
     */
    private String category;
    /**
     * 单位
     */
    private String unit;

    private StorePolicyType storePolicy;

    private Integer storeInterval;

    private ChangeType changeType;

    private Float changeValue;

    //private Boolean alarmEnable;
    //private Boolean alarmPlanEnable;
    //@ONodeAttr
    //private AlarmSetting alarmPolicy;
    //@ONodeAttr
    //private List<AlarmPlan> alarmPlan;

    public String getFieldTypeName(){
         if(fieldType!=null){
             return fieldType.getLabel();
         }
         return null;
    }
}
